#pragma once

#include "DirectInput8TypeDefs.h"
#include "../../Common/Interfaces/IDirectInputHijack.h"
#include "../../Common/DetourHelper.h"
#include <map>

class k_DirectInput8Hijack
	: public IDirectInputHijack
{
public:
	k_DirectInput8Hijack();
	virtual ~k_DirectInput8Hijack();

	// IObject
	void* QueryInterface(const GUID& ar_InterfaceGuid);

	// IService
	virtual void Initialize(IServiceLocator& ar_ServiceLocator);
	virtual void Deinitialize();
	virtual bool get_IsInitialized() const;

private:
	bool mb_Initialized;
	std::wstring ls_LogFile;

	static k_DirectInput8Hijack* instance;
	typedef k_DirectInput8Hijack SelfType; 

public: 
	DeclareHijack( HRESULT, SetCooperativeLevel, 
		(IDirectInputDevice8* inputDevice, HWND hwnd, DWORD level), 
		(inputDevice, hwnd, level)
	);

	DeclareHijack( HRESULT, CreateDevice, 
		(IDirectInput8* directInput, REFGUID rguid, LPDIRECTINPUTDEVICE *lplpDirectInputDevice, LPUNKNOWN pUnkOuter), 
		(directInput, rguid, lplpDirectInputDevice, pUnkOuter) 
	);

	DeclareHijack( HRESULT, GetDeviceState, 
		(IDirectInputDevice8* inputDevice, DWORD cbData, LPVOID lpvData), 
		(inputDevice, cbData, lpvData) 
	);
};
